<?php
// +--------------------------------------------------------------------------
// | ZAIYOUDAO [ 载攸道 先顺得常 ] <http://www.zaiyoudao.com>
// +--------------------------------------------------------------------------
// | Copyright © 2009-2016 载攸道 版权所有 <TEL:17090888854>
// +--------------------------------------------------------------------------
// | Project: YiPHP [ 我会的仅仅是偷懒！ ] <http://www.yiphp.com>
// +--------------------------------------------------------------------------
// | Author: 牛很多戒很多不戒 <n@isdce.com> <http://juexue.wang>
// +--------------------------------------------------------------------------

/**
 * 系统信息插件
 */
namespace Addon\ISDCEServe\Controller;
use Addon\ISDCEServe\Controller\CommonController;

/**
 * 系统信息插件 
 */
class ItemController extends CommonController{
	
	public function _initialize(){
		parent::_initialize();
		
		
		$item_conf= ADDON_PATH.'/ISDCEServe/Conf/conf.json';
		
		$josn_time_info = json_decode(file_get_contents($item_conf), true);
			
			
		$url  = 'http://api.fuwu.zaiyoudao.com/Auth/Account/Legal/appid/'.$josn_time_info['appid'].'/appsecret/'.$josn_time_info['appsecret'].'.html';
		$sdata = file_get_contents($url);  

		$josn_time_info['is_ok'] = $sdata;
		
		$this->assign('data',$josn_time_info);
		
		
	}
	
	/**
	 * 判断是否有权限 
	 */
	public function is_ok(){

	
		$item_conf= ADDON_PATH.'/ISDCEServe/Conf/conf.json';
		
		$josn_time_info = json_decode(file_get_contents($item_conf), true);
			
			
		$url  = 'http://api.fuwu.zaiyoudao.com/Auth/Account/Legal/appid/'.$josn_time_info['appid'].'/appsecret/'.$josn_time_info['appsecret'].'.html';
		$sdata = file_get_contents($url);  

		$josn_time_info['is_ok'] = $sdata;
		
		if(!$sdata){
			
			$url = $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].'/Home/Item/Conf/Addon/ISDCEServe.html';

			redirect("$url", 0,'');
			
			die;
				
		}
		
		
    }
	/**
	 * 系统信息 
	 */
	public function Conf(){
		
		
		
	
		//页面配置
		$page = array(
			
			'title'=>'项目设置',
			'keywords'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'description'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'author'=>'YiPHP',
			'robots' => 'all',
		
		);
		
		$this->assign('page',$page);
		
		$item_conf= ADDON_PATH.'/ISDCEServe/Conf/conf.json';
			
			
		if(IS_AJAX){
			
			action_log('addon_isdceserve_item_conf_edit');
		
			$myfile = fopen($item_conf, "w");
			
			
			$data = I();
			$new_info = json_encode($data);
			
			
			fwrite($myfile, $new_info);
				
		
			fclose($myfile);
		
			
			
			$this->ajaxReturn(get_errcode(0));
		
			
		}else{
			
			action_log('addon_isdceserve_item_conf_view');
		
		
			$this->view();
			
		}
		
		
    }
	
	
	/**
	 * 项目信息 
	 */
	public function Info(){
		
		$this->is_ok();
		
		action_log('addon_isdceserve_item_info');
		
		//页面配置
		$page = array(
			
			'title'=>'项目信息',
			'keywords'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'description'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'author'=>'YiPHP',
			'robots' => 'all',
		
		);
		
		$this->assign('page',$page);
		
		
		$this->view();
			
	
		
		
    }
	
	
	/**
	 * 项目需求 
	 */
	public function Demand(){
		
		$this->is_ok();
		
		action_log('addon_isdceserve_item_demand');
		
		//页面配置
		$page = array(
			
			'title'=>'项目需求',
			'keywords'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'description'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'author'=>'YiPHP',
			'robots' => 'all',
		
		);
		
		$this->assign('page',$page);
		
		
		$this->view();
			
	
		
		
    }
	
	/**
	 * 历史项目需求 
	 */
	public function DemandLog(){
		
		$this->is_ok();
		
		action_log('addon_isdceserve_item_demandlog');
		
		//页面配置
		$page = array(
			
			'title'=>'历史项目需求',
			'keywords'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'description'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'author'=>'YiPHP',
			'robots' => 'all',
		
		);
		
		$this->assign('page',$page);
		
		
		$this->view();
			
	
		
		
    }
	
	/**
	 * 进度排期 
	 */
	public function Calendar(){
		
		$this->is_ok();
		
		action_log('addon_isdceserve_item_calendar');
		
	
		//页面配置
		$page = array(
			
			'title'=>'进度排期',
			'keywords'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'description'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'author'=>'YiPHP',
			'robots' => 'all',
		
		);
		
		$this->assign('page',$page);
		
		$this->view();
			
	
		
		
    }
	
	/**
	 * 聊天室 
	 */
	public function Chatroom(){
		
		$this->is_ok();
		action_log('addon_isdceserve_item_chatroom');
		
	
		//页面配置
		$page = array(
			
			'title'=>'聊天室',
			'keywords'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'description'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'author'=>'YiPHP',
			'robots' => 'all',
		
		);
		
		$this->assign('page',$page);
		
		$this->view();
			
	
		
		
    }
	
	/**
	 * 服务人员 
	 */
	public function Developer(){
		
		$this->is_ok();
		
		action_log('addon_isdceserve_item_developer');
		

		//页面配置
		$page = array(
			
			'title'=>'服务人员',
			'keywords'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'description'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'author'=>'YiPHP',
			'robots' => 'all',
		
		);
		
		$this->assign('page',$page);
		
		$this->view();
			
	
		
		
    }
	
	/**
	 * 报价信息 
	 */
	public function Offer(){
		
		$this->is_ok();
		
		action_log('addon_isdceserve_item_offer');
		
		//页面配置
		$page = array(
			
			'title'=>'报价信息',
			'keywords'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'description'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'author'=>'YiPHP',
			'robots' => 'all',
		
		);
		
		$this->assign('page',$page);
		
		
		$this->view();
			
	
		
		
    }
	
	/**
	 * 合同信息 
	 */
	public function Contract(){
		
		$this->is_ok();
		
		action_log('addon_isdceserve_item_contract');
		

		//页面配置
		$page = array(
			
			'title'=>'合同信息',
			'keywords'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'description'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'author'=>'YiPHP',
			'robots' => 'all',
		
		);
		
		$this->assign('page',$page);
		
		
		$this->view();
			
	
		
		
    }
	
	/**
	 * 资金信息 
	 */
	public function Money(){
		
		$this->is_ok();
		
		action_log('addon_isdceserve_item_money');
		

		//页面配置
		$page = array(
			
			'title'=>'资金信息',
			'keywords'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'description'=>'YiPHP [ 我会的仅仅是偷懒！]',
			'author'=>'YiPHP',
			'robots' => 'all',
		
		);
		
		$this->assign('page',$page);
		
		$this->view();
			
	
		
		
    }
}